clear,clc;
syms x1 x2 x0 x
x0=0;x1=1;x2=2;y0=1;y1=2;y2=5;
g0=(x-x1)*(x-x2)/(x0-x1)/(x0-x2)
g1=(x-x0)*(x-x2)/(x1-x0)/(x1-x2)
g2=(x-x0)*(x-x1)/(x2-x0)/(x2-x1)
L=y0*g0+y1*g1+y2*g2